package cn.edu.cqvie.jdk8.fun;

import java.util.*;

public class StringComparator {

    public static void main(String[] args) {
        List<String> names = Arrays.asList("zhangsan","lisi", "wangwu", "zhaoliu");
        Collections.sort(names, new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return o2.compareTo(o1);
            }
        });

        Collections.sort(names, (String o1, String o2) -> {
            return o2.compareTo(o1);
        });

        Collections.sort(names, (o1, o2) -> {
            return o2.compareTo(o1);
        });

        Collections.sort(names, (o1, o2) -> o2.compareTo(o1));

        Collections.sort(names, Comparator.reverseOrder());

        System.out.println(names);
    }
}
